package program_structure;

import java.util.Scanner;

/**
 * @author : niu niu
 * @version : 1.0.0
 * @date : 2022/8/17 11:55
 * 分支结构
 *         if(){}分支
 *         if(){}else{} 分支
 *         if(){}else if (){} else{} 分支
 *         switch(){case 1: break;....default: break;  }
 */
public class ConditionStructure {
    public static void main(String[] args) {
        int grade =60;
        if(grade >= 90){
            System.out.println("666");
        }else if(grade>=60&&grade <90){
            System.out.println("还可以");
        }else{
            System.out.println("还需努力");
        }
        //1.判断奇数偶数
        Scanner scanner = new Scanner(System.in);
        int num =scanner.nextInt();
        if(num%2==0){
            System.out.println(num+"是偶数！");
        }else {
            System.out.println(num+"是奇数！");
        }
        //2.判断正数负数0
        int num1 =scanner.nextInt();
        if(num1>0){
            System.out.println(num+"是正数！");
        }else if(num1<0) {
            System.out.println(num+"是负数！");
        }else{
            System.out.println(num+"是0！");
        }
        //3.判断闰年
        int year = 2000;
        /*if((year%4==0&&year%100!=0)||(year%400==0)){
                条件表达式复杂，初学不推荐
        }*/
        if(year%100==0){
            //判断世纪闰年
            if(year%400==0){
                System.out.println(year+"是世纪闰年！");
            }else{
                System.out.println(year+"不是闰年！");
            }
        }else{
            if(year%4==0){
                System.out.println(year+"是普通闰年！");
            }else{
                System.out.println(year+"不是闰年！");
            }
        }
    }
}
